package com.yjd.comm.funds.service;

import com.yjd.comm.base.enums.DbWREnums;
import com.yjd.comm.base.model.PagerModel;
import com.yjd.comm.base.service.IBaseService;
import com.yjd.comm.funds.model.FundsModel;
import com.yjd.comm.funds.model.RechargeOrderModel;

import java.util.Map;

/**
 * <b>description</b>：用户资金表业务接口<br>
 * <b>time</b>：2017-09-19 15:07:07 <br>
 * <b>author</b>：  carl
 */
public interface IFundsService extends IBaseService {
	/**
	 * 插入
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public FundsModel insert(FundsModel model) throws Exception;

	/**
	 * 更新,大于等于1表示成功，其他失败
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public int update(FundsModel model) throws Exception;

	/**
	 * 根据id删除,大于等于1表示成功，其他失败
	 * 
	 * @param user_id
	 * @return
	 * @throws Exception
	 */
	public int delete(long user_id) throws Exception;


	/**
	 * 充值成功后账户余额增加
	 * @throws Exception
	 */
	public void rechAddPrice(RechargeOrderModel orderModel,Long currtime)throws Exception;

	/**
	 *  用户首付扣款
	 * @param user_id
	 * @param price
	 * @param ref_id
	 * @throws Exception
	 */
	public void firstPay(Long user_id,Double price,String ref_id,Long currtime)throws Exception;

	/**
	 *  用户还款扣款
	 * @param user_id 用户id
	 * @param price 用户应还款金额
	 * @param ref_id  关联id
	 * @param interest 当期利息
	 * @param overdue_price 罚息金额
	 * @param discount_amount  减免金额
	 * @throws Exception
	 */
	public void repaymentPay(Long user_id,Double price,Double overdue_price,Double discount_amount,Double interest,
							 String ref_id,Long currtime)throws Exception;

	/**
	 * 增加账户余额
	 * @param paramMap
	 * @return
	 * @throws Exception
	 */
	public int increasePrice(Map<String, Object> paramMap) throws Exception;

	/**
	 * 获取用户资金信息
	 *
	 * @param paramMap 查询参数列表
	 * @param write 是否是操作主库
	 * @return 返回结果列表
	 * @throws Exception
	 */
	@SuppressWarnings("rawtypes")
	public PagerModel queryUserFunds(Map<String, Object> paramMap, DbWREnums write) throws Exception;

	/**
	 * 退还用户首付款（适用于用户自助取消、商户拒绝）
	 * CMT: 给user_id退还payment元，与order_id相关
	 *
	 * @param user_id 用户id
	 * @param payment 首付款
	 * @return 返回结果列表
	 * @throws Exception
	 */
	public void paymentRefund(Long user_id, Double payment, Long order_id)throws Exception;

	/**
	 * 更新用户资金
	 * @param user_id
	 * @param param
	 * @throws Exception
	 */
	public int updatByMap(Long user_id,Map param)throws Exception;


	/**
	 * 商户确认退单更新资金情况
	 * @param paramMap
	 * @return
	 * @throws Exception
	 */
	public int addPriceOfOrderRturn(Map<String, Object> paramMap) throws Exception;
}
